<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">\section{exist --- Test for an argument}
\label{fn:exist}
\index{exist()}
\index{testing for an argument}
\index{argument!testing for}
\begin{rail}
Exist : 'exist' '(' ( Scalar | Matrix | List | String) ')' ;
\end{rail}

\verb+exist+ is a function that tests whether its argument is actually
a legitimate variable or function. If the argument exists, then \verb+exist+
returns $1$, or true if you prefer, and returns $0$, or false, if the
argument doesn't exist.

Note that you can't pass a constant value as an argument, and passing
an argument that has enough brackets to look like a function, but
isn't really a function, gives an error message.  This is caused by
\RLaB\ not being able to evaluate the function.

In general, you should be using this function in general purpose
user-defined functions to make sure all the neccessary arguments are
present, and to provide defaults as appropriate.


\paragraph{Example}
\index{example of exist()}
\index{exist()!example}
\begin{verbatim}
&gt; who()
eps  pi                  
&gt; exist(eps)
        1
&gt; exist(sin)
        1
&gt; exist(sin(2))
        1
&gt; exist(2)
rlab: invalid argument to exist,
\end{verbatim}

See also: Page~\pageref{fn:what} \verb+what()+,
Page~\pageref{fn:who} \verb+who()+.

\newpage






</pre></body></html>